﻿-- Define the relationship between PersonSecurityRole and Person
ALTER TABLE [dbo].[PersonSecurityRole] WITH CHECK ADD  
       CONSTRAINT [FK_PersonSecurityRole_Role] FOREIGN KEY([SecurityRole])
REFERENCES [dbo].[SecurityRole] ([RoleId])
ON DELETE NO ACTION
GO
-- Define the relationship between PersonSecurityRole and Person
ALTER TABLE [dbo].[PersonSecurityRole] WITH CHECK ADD  
       CONSTRAINT [FK_PersonSecurityRole_Person] FOREIGN KEY([PersonId])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between PersonSecurityRole and Person
ALTER TABLE [dbo].[PersonSecurityRole] WITH CHECK ADD  
       CONSTRAINT [FK_PersonSecurityRole_CreatedByPerson] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO